package lab01;

import java.util.Scanner;

public class Xunhuan {
    void computeNum() {
        int sum = 0, i = 1;
        while (i <= 100) {
            if (i % 2 != 0)
                sum = sum + i;
            else
                sum = sum - i;
            i++;
        }
        System.out.println("1 - 2 + 3 - 4…+ 99 - 100=" + sum);
    }

    static void main() {
        Scanner sc = new Scanner(System.in);
        Xunhuan x = new Xunhuan();
        x.computeNum();
    }
}
